package com.viphuli.app.tool.common;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;

import com.viphuli.app.tool.R;

public class SplitTextView extends TextView {

	public SplitTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public void onDraw(Canvas canvas) {

		if (getText().length() > 1) {

			Paint paint = new Paint();
			paint.setAntiAlias(true);//抗锯齿
			paint.setColor(getResources().getColor(R.color.cl_gray_light));// 设置颜色 

			float lineSize = getContext().getResources().getDimension(R.dimen.dp_common_list_line_size);
			paint.setStrokeWidth(lineSize);//设置画出的线的 粗细程度  

			float startX = getX() + getWidth();
			float startY = getX();
			
			float endX = getY();
			float endY = getY() + getHeight();
			
			canvas.drawLine(startX, startY, endX, endY, paint);// 斜线 

		}

		super.onDraw(canvas);

	}

}
